package com.dongjiantong.quarantine.serviceImpl;

import com.alibaba.dubbo.config.annotation.Service;
import com.dongjiantong.mybatis.ServiceMybatis;
import com.dongjiantong.quarantine.mapper.DjtButcherReportCertsMapper;
import com.dongjiantong.quarantine.model.DjtButcherReportCerts;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * Created by mz on 21/11/17.
 *
 */
@Slf4j
@Service(version = "1.0.0")
public class DjtButcherReportCertsReadServiceImpl extends ServiceMybatis<DjtButcherReportCerts> implements DjtButcherReportCertsReadService{

    @Resource
    private DjtButcherReportCertsMapper djtButcherReportCertsMapper;

    /**
     * 获取当前屠宰单据的发证数量
     *
     * @param map 参数
     * @return Long
     */
    @Override
    public Long countByReportId(Map<String , Object> map) {

        Long count = djtButcherReportCertsMapper.countByReportId(map);

        return count;
    }

    /**
     * 分页查询屠宰检疫的证
     *
     * @param pageNo   页码
     * @param pageSize 每页多少条
     * @param map      参数
     * @return PageInfo<DjtButcherReportCerts>
     */
    @Override
    public PageInfo<DjtButcherReportCerts> paging(Integer pageNo, Integer pageSize, Map<String, Object> map) {

        PageHelper.startPage(pageNo,pageSize);

        List<DjtButcherReportCerts> list = djtButcherReportCertsMapper.findCertsByReportId(map);

        PageInfo<DjtButcherReportCerts> djtButcherReportCertsPageInfo = new PageInfo<DjtButcherReportCerts>(list);

        return djtButcherReportCertsPageInfo;
    }
}
